perm filename MACRO[S1,ALS]1 blob
sn#399901 filedate 1978-11-30 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00006 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 procedure ASSERTFAIL(MSG : CHAR12)
C00007 00003 Procedure for testing SOPS07.PAS
C00013 00004 αXDEFINE ASSERTC
C00015 00005 αXDEFINE ASSERTC
C00017 00006 αXDEFINE TOOBIGC
C00019 ENDMK
C⊗;
procedure ASSERTFAIL(MSG : CHAR12);
(*ASSERTFAIL is used for internal consistency checking of the program.
The BOOLEAN that is a parameter in the ASSERT calls is here tested
before calling ASSERTFAIL, to avoid needless procedure calls.
The message in MSG is printed (to identify the particular
assertion) togather with an assertion count (now only a count of
the failed assertions) and execution is terminated. Note, that as it
is, only one failure will be reported. By not EXITTing one might get
more information from an attempted compilation.*)
begin
ASSERTCOUNT := ASSERTCOUNT + 1;
WRITELN(OUTPUT);
WRITELN(OUTPUT);
WRITELN(OUTPUT,'***** ERROR ***** Assertion #',ASSERTCOUNT:6,
' failed : ',MSG,' *****');
ASSERTCOUNT := ASSERTCOUNT div (ASSERTCOUNT-ASSERTCOUNT);
EXITT(9999)
end (*ASSERTFAIL*);
The macro for changing the ASSERT calls to ASSERTFAIL calls
αXF ASSERT ('αβ⊗C(*ASSERT ('...',BOOLEAN) Replaced 11/27/78 ALS*)α⊗C⊗⊂ Insert note
2⊃⊗CαFASSERTαβ\IF NOTα⊗Cα(α β⊗C⊗⊂ Replace ASSERT with IF NOT and split line
3⊃αI THEN ASSERTFAIL (α⊗C⊗⊂ Insert THEN at start
4⊃αF'α⊗CαF',αβ\'α⊗Cα β)β⊗C⊗⊂ Find second ' delete , and split again
5⊃⊗B⊗Bαβ(αβ)α β⊗C⊗⊂ Back up prime ( and find ) and split again
6⊃αβxzmarkαβ⊗CαβMα↔α⊗C⊗⊂ MARK split piece and back to (
7⊃αβA⊗CαβEα⊗TαDα⊗C⊗⊂ Attach move +1 join next piece
8⊃⊗BαβAαMαβEα⊗TαDα⊗C⊗⊂ Back ATTACH move to mark join
9⊃⊗Bα⊗TαD⊗C⊗;
The macro for changing ASSERTFAIL calls back to ASSERT calls
αXF (*ASSERT ('...',BOOLEAN) Replaced⊗C⊗⊂ Locate
2⊃αβD⊗⊂ Delete comment
3⊃αFIF NOT (αβ\ASSERT (,α⊗Cβ⊗C⊗⊂ Replace IF NOT with ASSERT, split at ,
4⊃αβXZMARKαβ⊗CαβM⊗⊂ MARK second piece
5⊃⊗Bαβ(αβ)αF THEN ASSERTFAIL (αβ\ α⊗C⊗⊂ Delete THEN ASSERTFAIL (
6⊃αDβ⊗CαF')αβ\'α⊗Cα β⊗Cα⊗C⊗⊂ Split line FIND ') delete ) and split again
7⊃αβA⊗BαβE⊗Bα⊗TαD⊗C⊗⊂ Join 1st and 3rd pieces
8⊃αβAαMαβE⊗Bα⊗TαDα⊗TαD⊗C⊗; ATTACH, move middle section and join
Samples to try MACROs
THEN ASSERT ('ZZZ(,)ZZZ',BOOLEAN
MORE BOOLEAN
STILL MORE)(*POSSIBLE COMMENT*);
ELSE ASSERT ('ZZZ(,)ZZZ',BOOLEAN)
THEN ASSERT ('ZZZ(,)ZZZ',BOOLEAN
MORE BOOLEAN
STILL MORE)
THEN ASSERT ('ZZZ(,)ZZZ',BOOLEAN);
Macro defined by putting cursor at first line of the macro and typing
αβ9αβXREDEFINE<CR> (for first macro)
αβ8αβXREDEFINE<CR> (for second macro)
Note, the FIND looks for "ASSERT ('" to avoid possible garbaging in wrong places
ASSERT(' cases are to be handled by first changing them to ASSERT ('. Finally,
a search should be made of all remaining ASSERT's to find any missing cases.
MACRO is run by typing ⊗∞⊗Y
Procedure for testing SOPS07.PAS
Compile my version of SOPA on SYS:PASCAL
SSave as SOPA.DMP
The DO file for this is
R PASCAL 240↔
SOPS07.REL↔
SOPS07.LST↔
SOPS07.PAS↔
LOAD SOPA07.LST
SSAVE SOPS07.DMP|
Make up a small TEST.PAS file
Compile this file with PCP
Output TEST.PCO
Source TEST.PAS
Listing TEST,LST
The DO file for this is
RUN PCPE03.DMP[DMP,S1]↔
TEST.PCO↔
TEST.LST↔
TEST.PAS|
Compile TEST.PCO with the new SOPA
Output TEST.LDI
Listing TEST.PSI
Source TEST.PCO
The DO file for this is
RUN SOPS07.DMP↔
TEST.LDI↔
TEST.PSI↔
TEST.PCO|
MACRO TO TEST FOR LONG LINES.
αXDEFINE ASSERT⊗C
αXF ASSERT ('αβ⊗C(*ASSERT ('...',BOOLEAN) Replaced 11/27/78 ALS*)α⊗C⊗⊂ Insert note
2⊃⊗CαFASSERTαβ\IF NOTα⊗C
αXSET IND←COL.⊗Cαβ5αXSUBTRACT IND⊗C
α(α β⊗C⊗⊂ Replace ASSERT with IF NOT and split line
3⊃αI THEN ASSERTFAIL (α⊗C⊗⊂ Insert THEN at start
4⊃αF'α⊗CαF',αβ\'α⊗Cα β)β⊗C⊗⊂ Find second ' delete , and split again
5⊃⊗B⊗Bαβ(αβ)α β⊗C⊗⊂ Back up prime ( and find ) and split again
6⊃αβxzmarkαβ⊗CαβMα↔α⊗C⊗⊂ MARK split piece and back to (
7⊃αβA⊗CαβEα⊗TαDα⊗C⊗⊂ Attach move +1 join next piece
8⊃⊗BαβAαMαβEα⊗TαDα⊗C⊗⊂ Back ATTACH move to mark join
9⊃⊗Bα⊗TαDα⊗C⊗;
αZSPLIT⊗C
αβ⊗L
αXDEFINE SPLIT⊗C
αXSTOPONE⊗C
αβ7αβ2αXIFGE COLS.⊗C
αF THEN ASSERTFAIL (α⊗CαDβ⊗CαXARGUMENT IND⊗Cβ α⊗C
αβ⊗L
αXDEFINE ASSERT⊗C
αXF ASSERT('⊗C⊗B⊗C
αFASSERTαβ\if not α⊗C ⊗;Replace ASSERT with if not
αXSET IND←COL.⊗Cαβ2αXSUBTRACT IND⊗C ⊗;Get COL for O in if not
α(α β⊗C ⊗;Establish ( and split line
αI then ASSERTFAIL(α⊗C ⊗;Insert then ASSERTFAIL
αF'α⊗CαF',αβ\'α⊗Cα β)β⊗C ⊗;Find second ' delete , and split again
⊗B⊗Bαβ(αβ)α β⊗C ⊗;Back up prime ( and find ) and split again
αβxzmarkαβ⊗CαβMα↔α⊗C ⊗;MARK split piece and back to (
αβA⊗CαβEα⊗TαDα⊗C ⊗;Attach move +1 join next piece
⊗BαβAαMαβEα⊗TαDα⊗C ⊗;Back ATTACH move to mark join
⊗Bα⊗TαDα⊗C⊗;
αZSPLIT⊗C
αβ⊗L
αXDEFINE SPLIT⊗C
αXSTOPONE⊗C
αβ8αβ0αXIFLE COLS.⊗C
αF ASSERTFAILα⊗CαDβ⊗CαXARGUMENT IND⊗Cβ α⊗C
αβ⊗L
αXDEFINE TOOBIG⊗C
⊗C
αβ8αβ0αXIFGE COLS.⊗C
⊗B⊗C
αβ-αβ1αXIFLT CHARS.⊗C
αβ⊗L